﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EuroManager.Domain.Simulator.AI;
using EuroManager.Domain.Simulator.AI.States;
using EuroManager.Domain.Simulator.Engine;
using EuroManager.Domain.Simulator.Tests.World;
using EuroManager.Domain.Simulator.World;
using NUnit.Framework;
using Rhino.Mocks;

namespace EuroManager.Domain.Simulator.Tests.AI.States
{
    [TestFixture]
    public class ChaseBallStateTests
    {
        private ChaseBallState state;
        private IPlayer player;
        
        [SetUp]
        public void SetUp()
        {
            player = MockRepository.GenerateMock<IPlayer>();
            state = new ChaseBallState(player);
        }

        [Test]
        public void ShouldTrapBallWhenAbleToReachIt()
        {
            player.Stub(p => p.CanReachBall).Return(true);
            player.Expect(p => p.TrapBall());

            state.Execute();

            player.VerifyAllExpectations();
        }

        [Test]
        public void ShouldControlBallWhenReachedIt()
        {
            player.Stub(p => p.CanReachBall).Return(true);
            player.Expect(p => p.ControlBall());

            state.Execute();

            player.VerifyAllExpectations();
        }

        [Test]
        public void ShouldRunToBallWhenCannotReachIt()
        {
            player.Stub(p => p.CanReachBall).Return(false);
            player.Expect(p => p.RunToBall());

            state.Execute();

            player.VerifyAllExpectations();
        }
    }
}
